<template>
  <div class="box">
        <div class="top">
            <div class="top-left">
                <img src="/static/imgs_s02/head-img.png" alt="">
                <div class="p">
                    <p class="czy">{{memberInfo.nickname}}</p>
                    <div class="jf">
                        <p class="wdjf">我的积分：</p><span>{{memberInfo.integration}}</span>
                    </div>
                </div>
            </div>
            <img class="bg" src="/static/imgs_s02/bg.png" alt="">
            <div class="kuang">
                <div class="kuang-left">
                    <img src="/static/imgs_s02/s02_jifen-details.png" alt="">
                    <span @click="integralSub(memberInfo.id)">积分明细</span>
                </div>
                <div class="kuang-right" >
                    <img src="/static/imgs_s02/change-write.png" alt="">
                    <span>兑换记录</span>
                </div>
            </div>
        </div>
        <!-- ////////////////////////// -->
        <div class="content">
            <div class="div1" @click="exchangeDetails(integralPro.id)" v-for="(integralPro, index) in integralPros" :key="index">
                <img src="/static/imgs_s02/s02_goods1.png" alt="">
                <div class="jieshao">
                    <span>{{integralPro.name}}</span>
                    <div class="cont1">
                        <span>{{integralPro.price}}</span>
                        <button>立即兑换</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>

export default {
  data () {
    return {
      memberInfo:{},
      integralPros:[]
      }
    },

  methods: {
   integralSub:function(memberId){
        wx.navigateTo({url: '/pages/s10_Mall01/main?memberId='+memberId}); 
   },
   exchangeDetails:function(proId){
       wx.navigateTo({url: '/pages/s10_Mall02/main?proId='+proId});
   }
  },
    onLoad:function(options){
        wx.request({
        url: 'http://localhost:7777/userm/getUserById?id='+options.memberId, //开发者服务器接口地址",
        method: 'GET',
        dataType: 'json', //如果设为json，会尝试对返回的数据做一次 JSON.parse
        success: res => {
            console.log(res.data[0]);
            this.memberInfo=res.data[0];
        },
        fail: () => {},
        complete: () => {}
        });
        wx.request({
        url: 'http://localhost:7777/prom/listIntegralPro?shopId=1', 
        method: 'GET',
        dataType: 'json', //如果设为json，会尝试对返回的数据做一次 JSON.parse
        success: res => {
            this.integralPros=res.data;
        },
        fail: () => {},
        complete: () => {}
        });
    },
  created () {

  }
}
</script>

<style scoped>
        .box {
            width: 100%;
            height: 722px;

        }

        .top {
            background: #32B16C;
            height: 132px;
            width: 375px;
            position: relative;
        }

        .top .bg {
            width: 133px;
            height: 132px;
            position: absolute;
            left: 242px;
            top: 22px;

        }

        .top-left {
            display: flex;
            flex-direction: row;
            padding-top: 22px;
        }

        .top-left img {
            width: 59px;
            height: 59px;
        }

        .czy {
            font-size: 16px;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: rgba(255, 255, 255, 1);
        }

        .wdjf {
            font-size: 13px;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: rgba(255, 255, 255, 1);
        }

        .jf {
            display: flex;
            flex-direction: row;
            margin-top: 17px;
        }

        .jf span {
            font-size: 18px;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: rgba(255, 255, 255, 1);
            margin-left: 4px;
        }

        .p {
            display: flex;
            flex-direction: column;
            margin-left: 10px;
        }


        .kuang {
            width: 347px;
            height: 60px;
            background: rgba(255, 255, 255, 1);
            border-radius: 9px;
            position: absolute;
            left: 14px;
            top: 90px;
            z-index: 3;
            display: flex;
            flex-direction: row;

        }

        .kuang img {
            width: 18px;
            height: 18px;
        }

        .kuang-left {
            margin-left: 47px;
            margin-top: 24px;
            display: flex;
            flex-direction: row;

        }

        .kuang-right {
            margin-left: 104px;
            margin-top: 24px;
            display: flex;
            flex-direction: row;

        }

        .kuang span {
            margin-left: 6px;
            font-size: 13px;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: rgba(44, 44, 47, 1);
        }

        .div1{
            width: 178px;
            height: 260px;
            background: rgba(255, 255, 255, 1);
            border-radius: 9px;
            background: white;
        }

        .div1 {
            float: left;
            /* position: absolute;
            left: 5px;
            top: 29px; */
            background: white;
        }

        .content {
            position: relative;
            background: #F6F6F6;
            height: 569px;
        }

        .content img {
            width: 179px;
            height: 179px;
        }

        .jieshao {
            margin-left: 12px;
            margin-top: 11px;
        }

        .cont1 button {
            width: 75px;
            height: 16px;
            line-height: 16px;
            border: 0px solid rgba(64, 175, 117, 1);
            border-radius: 6px;
            margin-left: 46px;
            font-size: 11px;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: rgba(64, 175, 117, 1);
            margin-bottom: 8px;
        }

        .jieshao span {
            font-size: 12px;
            font-family: Source Han Sans CN;
            font-weight: 400;
            color: rgba(44, 44, 47, 1);
        }

        .cont1 {
            display: flex;
            flex-direction: row;
            margin-top: 8px;
        }

        .cont1 span {
            font-size: 11px;
            font-family: Source Han Sans CN;
            font-weight: 500;
            color: rgba(241, 145, 73, 1);
            margin-bottom: 12px;
        }
</style>
